import 'package:flutter/material.dart';

class GridBuildView extends StatelessWidget {
  const GridBuildView({super.key});

  @override
  Widget build(BuildContext context) {
    //写法二：命名构造函数写法
    return GridView.builder(
      gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
        crossAxisCount: 2,
        mainAxisSpacing: 10,
        crossAxisSpacing: 10,
        childAspectRatio: 1 / 1,
      ),
      itemCount: 10,
      itemBuilder: (context, index) {
        return Container(
          color: Colors.orange,
        );
      },
    );
  }
}
